import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetSceneColumnDetail_ {
  /**
   * @description 页码
   * @format int32
   */
  pageNum?: number;
  /**
   * @description 每页数量
   * @format int32
   */
  pageSize?: number;
  /**
   * @description 表id
   * @format int32
   */
  tableId?: number;
}
export interface DeleteSceneDeleteById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetSceneGetColumnInfo_ {
  /**
   * @description 场景id
   * @format int32
   * @example 1
   */
  id?: number;
  /**
   * @description 页码
   * @format int32
   * @example 1
   */
  pageNum?: number;
  /**
   * @description 每页大小
   * @format int32
   * @example 1
   */
  pageSize?: number;
  /**
   * @description tableSource数据源表
   * @format int32
   * @example 1
   */
  tableSource?: number;
}
export interface GetSceneGroupRoot_ {
  /**
   * @description data
   * @format int32
   */
  data: number;
}
export interface DeleteSceneGroupById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetSceneHintName_ {
  /**
   * @description 场景中文名称
   */
  cnName?: string;
}
export interface GetSceneJudgeInfo_ {
  /**
   * @description 场景Id
   * @format int32
   */
  sceneId?: number;
  /**
   * @description 数据源表Id
   * @format int32
   */
  tableId?: number;
}
export interface PutSceneStatusById_ {
  /**
   * @description 场景状态(0-正常，1-禁用，2-草稿1，3-草稿2)
   * @format int32
   */
  status?: number;
  /**
   * @description 场景id
   * @format int32
   */
  id?: number;
}
export interface GetSceneById_ {
  /**
   * @description 主键id
   */
  id: number;
}
export interface PutSceneById_ {
  /**
   * @description 主键id
   */
  id: number;
}

export class Scene {
  /**
   * 添加场景
   *
   * @tags 场景管理配置
   * @request POST: /scene
   * @secure
   */
  postScene = (body: defs.SceneDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntitySceneVO>({
      url: `/scene`,
      method: "POST",
      data: body,
      ...params,
    });

  /**
   * 根据数据源表id获取表字段
   *
   * @tags 场景管理配置
   * @request GET: /scene/column-detail
   * @secure
   */
  getSceneColumnDetail = (
    query: { pageNum?: number; pageSize?: number; tableId?: number } | GetSceneColumnDetail_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListSceneColumnInfoVO>({
      url: `/scene/column-detail`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 删除场景
   *
   * @tags 场景管理配置
   * @request DELETE: /scene/delete/{id}
   * @secure
   */
  deleteSceneDeleteById = ({ id }: { id: number } | DeleteSceneDeleteById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityString>({
      url: `/scene/delete/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 根据id、tableSource、pageNum、pageSize查询数据源表字段信息
   *
   * @tags 场景管理配置
   * @request GET: /scene/get_column_info
   * @secure
   */
  getSceneGet_column_info = (
    query: { id?: number; pageNum?: number; pageSize?: number; tableSource?: number } | GetSceneGetColumnInfo_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListSceneColumnInfoVO>({
      url: `/scene/get_column_info`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 添加场景分组
   *
   * @tags 场景管理配置
   * @request POST: /scene/group
   * @secure
   */
  postSceneGroup = (sceneGroupDTO: defs.SceneGroupDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/scene/group`,
      method: "POST",
      data: sceneGroupDTO,
      ...params,
    });

  /**
   * 修改场景分组
   *
   * @tags 场景管理配置
   * @request PUT: /scene/group
   * @secure
   */
  putSceneGroup = (sceneGroupDTO: defs.SceneGroupDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/scene/group`,
      method: "PUT",
      data: sceneGroupDTO,
      ...params,
    });

  /**
   * 查询场景分组树
   *
   * @tags 场景管理配置
   * @request GET: /scene/group/root
   * @secure
   */
  getSceneGroupRoot = (query: { data: number } | GetSceneGroupRoot_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/scene/group/root`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 删除场景分组
   *
   * @tags 场景管理配置
   * @request DELETE: /scene/group/{id}
   * @secure
   */
  deleteSceneGroupById = ({ id }: { id: number } | DeleteSceneGroupById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/scene/group/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 根据场景中文名称模糊查询
   *
   * @tags 场景管理配置
   * @request GET: /scene/hint-name
   * @secure
   */
  getSceneHintName = (query: { cnName?: string } | GetSceneHintName_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListSceneVO>({
      url: `/scene/hint-name`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 判断场景是否绑定了第三步的数据
   *
   * @tags 场景管理配置
   * @request GET: /scene/judge-info
   * @secure
   */
  getSceneJudgeInfo = (
    query: { sceneId?: number; tableId?: number } | GetSceneJudgeInfo_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityBoolean>({
      url: `/scene/judge-info`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 获取场景列表
   *
   * @tags 场景管理配置
   * @request POST: /scene/list
   * @secure
   */
  postSceneList = (body: defs.SceneQueryDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/scene/list`,
      method: "POST",
      data: body,
      ...params,
    });

  /**
   * 全部场景分组查询
   *
   * @tags 场景管理配置
   * @request GET: /scene/simple-list
   * @secure
   */
  getSceneSimpleList = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListOptionVO>({
      url: `/scene/simple-list`,
      method: "GET",
      ...params,
    });

  /**
   * 改变场景状态
   *
   * @tags 场景管理配置
   * @request PUT: /scene/status/{id}
   * @secure
   */
  putSceneStatusById = (
    { id, ...query }: { status?: number; id?: number } | PutSceneStatusById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntity>({
      url: `/scene/status/${id}`,
      method: "PUT",
      params: query,
      ...params,
    });

  /**
   * 根据id查询
   *
   * @tags 场景管理配置
   * @request GET: /scene/{id}
   * @secure
   */
  getSceneById = ({ id }: { id: number } | GetSceneById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntitySceneVO>({
      url: `/scene/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 更新场景元数据信息
   *
   * @tags 场景管理配置
   * @request PUT: /scene/{id}
   * @secure
   */
  putSceneById = ({ id }: { id: number } | PutSceneById_, body: defs.SceneDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntitySceneVO>({
      url: `/scene/${id}`,
      method: "PUT",
      data: body,
      ...params,
    });
}

export default new Scene();
